//
// Copyright (c) 2024 BPer
//
#include <bperutil/buffer2/BPerVideoEncoderBuffer2.h>

void bPer_videoEncoderBuffer2_getEVideo(BPerMediaBuffer2* buf,BPerFrame* pframe){

	buf->getFrame(&buf->session,pframe);
}
uint8_t * bPer_videoEncoderBuffer2_getEVideoRef(BPerMediaBuffer2* buf,BPerFrame* frame){
	return buf->getFrameRef(&buf->session,frame);

}
void bPer_videoEncoderBuffer2_putEVideo(BPerMediaBuffer2* buf,BPerFrame* pframe){
	buf->putFrame(&buf->session,pframe);
}
int32_t bPer_videoEncoderBuffer2_size(BPerMediaBuffer2* buf){
	return buf->session.size;
}
void bPer_videoEncoderBuffer2_resetIndex(BPerMediaBuffer2* buf){
	 buf->resetIndex(&buf->session);
}

void bPer_create_videoEncoderBuffer2(BPerVideoEncoderBuffer2* buf,int pcachenum){
	BPerMediaBuffer2* mb=&buf->mediaBuffer;
	bPer_create_mediaBuffer2(mb);
	mb->resetIndex(&mb->session);
	mb->session.cache_num=pcachenum;
	mb->initFrames(&mb->session,mb->session.cache_num,BPER_VIDEO_ENCODE_BUFFER_LEN);
	buf->getEVideo=bPer_videoEncoderBuffer2_getEVideo;
	buf->getEVideoRef=bPer_videoEncoderBuffer2_getEVideoRef;
	buf->putEVideo=bPer_videoEncoderBuffer2_putEVideo;
	buf->size=bPer_videoEncoderBuffer2_size;
	buf->resetIndex=bPer_videoEncoderBuffer2_resetIndex;

}
void bPer_destroy_videoEncoderBuffer2(BPerVideoEncoderBuffer2* buf){
	BPerMediaBuffer2* mb=&buf->mediaBuffer;
	bPer_destroy_mediaBuffer2(mb);
}

